﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.UserControls
{
    public partial class StatusPanel : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //showMe()
        }

        private void showMe()
        {
            String status;
            if (Request.QueryString["stat"] != null)
            {
                status = Request.QueryString["stat"];

                if (status.IndexOf("succ") == 0)
                    pnlStatus.CssClass = "alert alert-success alert-dismissable";
                else if (status.IndexOf("fail") == 0)
                    pnlStatus.CssClass = "alert alert-danger alert-dismissable";
                else
                    pnlStatus.CssClass = "alert alert-info alert-dismissable";

                //if (Message.Words.ContainsKey(status))
                //    lblMessage.Text = Message.Words[status];
                //else
                //    lblMessage.Text = Message.Words["default"];
            }
            else this.Visible = false;
        }

        public void ShowSuccess(string msg)
        {
            pnlStatus.Visible = true;
            pnlStatus.CssClass = "alert alert-success alert-dismissable";
            lblMessage.Text = msg;
        }

        public void ShowError(string msg)
        {
            pnlStatus.Visible = true;
            pnlStatus.CssClass = "alert alert-danger alert-dismissable";
            lblMessage.Text = msg;
        }

        public void ShowWarning(string msg)
        {
            pnlStatus.Visible = true;
            pnlStatus.CssClass = "alert alert-warning alert-dismissable";
            lblMessage.Text = msg;
        }

        public void Hide()
        {
            pnlStatus.Visible = false;
        }
    }
}